package com.yundasys.lab10designpattern.singleton;

/**
 * 第2种-对方法加sychronize锁(俗称的懒汉模式)
 * 
 * @author jiangta
 * @version 1.0
 * @date 2021/4/14 10:15 上午
 */
public class LazySingleton {
    private static LazySingleton instance;
    public synchronized static LazySingleton getInstance() {
        if(instance == null) {
            instance = new LazySingleton();
        }
        return instance;
    }
}
